package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsFootprintMapper;
import com.qf.pojo.DtsFootprint;
import com.qf.service.DtsFootprintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @version 1.0
 * @auther Administrator
 * @date 2023/2/24 14:44
 */
@Service
public class DtsFootprintServiceImpl implements DtsFootprintService {
    @Autowired
    private DtsFootprintMapper dtsFootprintMapper;

    @Override
    public IPage<DtsFootprint> findListByQuery(Integer page, Integer limit, String sort, String order, Integer userId, Integer goodsId) {
        return dtsFootprintMapper.selectPage(new Page<DtsFootprint>(page,limit),new QueryWrapper<DtsFootprint>()
                .like(!StringUtils.isEmpty(userId),"user_id",userId)
                .like(!StringUtils.isEmpty(goodsId),"goods_id",goodsId)
                .orderBy(!StringUtils.isEmpty(sort),"ASC".equalsIgnoreCase(order),sort));
    }
}
